/*
 * @Author       : Thyssen Wen
 * @Date         : 2022-09-22 12:37:23
 * @LastEditors  : Thyssen Wen
 * @LastEditTime : 2022-09-23 03:28:41
 * @Description  : Factory Class
 * @FilePath     : /cdesign-pattern/Factory/Factory.h
 */
#pragma once
#include "Product.h"
#include <string>
namespace framework{
    class Factory;
}

class framework::Factory
{
protected:
    virtual Product* createProduct(std::string owner)=0;
    virtual void registerProduct(Product* product)=0;
public:
    Factory(/* args */);
    ~Factory();

    virtual Product* create(std::string owner) final;
};

framework::Factory::Factory(/* args */)
{
}

framework::Factory::~Factory()
{
}

framework::Product* framework::Factory::create(std::string owner)
{
    Product *p = createProduct(owner);
    registerProduct(p);
    return p;
}